package org.esprit.ocm.client.rpc.ec2;

import java.util.List;

import org.esprit.ocm.dto.ec2.impl.GroupDescriptionMappingDto;
import org.esprit.ocm.dto.impl.AwsCredentialsDto;
import org.esprit.ocm.dto.impl.ServerDto;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("SecurityGroupService.rpc")
public interface SecurityGroupService extends RemoteService {

	/**
	 * Create a security group that can be assigned to an instance.
	 * 
	 * @param name
	 * @param description
	 * @return true if successfull, false else (e.g. if group with same name
	 *         already exists).
	 */
	public boolean createSecurityGroup(String name, String description, ServerDto server, AwsCredentialsDto credentials);

	/**
	 * Delete a security group.
	 * 
	 * @param name
	 *            Name of the group to delete. *
	 * @return true if successfull, false else (e.g. if group is assigned to a
	 *         running instance).
	 */
	public boolean deleteSecurityGroup(String name, ServerDto server, AwsCredentialsDto credentials);

	/**
	 * List all available Security groups.
	 * 
	 * @return
	 */
	public List<GroupDescriptionMappingDto> listSecurityGroups(ServerDto server, AwsCredentialsDto credentials);

	/**
	 * Gets the properties of a specific security group.
	 * 
	 * @param name
	 *            The name of the group.
	 * @return GroupDescription or null in case of error or if group does not
	 *         exist.
	 */
	public GroupDescriptionMappingDto describeSecurityGroup(String name, ServerDto server, AwsCredentialsDto credentials);
}
